package com.coffee.attachment.excel;


import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;

import java.util.Date;

/**
 * @author: songkui
 * @since: 2023/5/15 10:04
 */
public final class ExcelConstant {
    private ExcelConstant(){}

    public static final String ExcelExt = ".xlsx";

    public static final String ExportBucket = "document-excel"; //TODO 可以配置
    public static final String ExportObject = "export/%s/%s%s"; //
    public static final String ExportFileName = "%s-%s%s";


    public static String buildExportObject(String excelCode, String random){
        return String.format(ExportObject, excelCode, random, ExcelExt);
    }

    public static String buildExportFileName(String title, String random){
        return String.format(ExportFileName, title, random, ExcelExt);
    }



    public static final String ImportBucket = "document-excel"; //TODO 可以配置
    public static final String ImportExt = ".xlsx,.xls";
    public static final String ImportObject = "import/%s/%s%s";
    public static final String ImportFileName = "%s-%s";

    public static String buildImportObject(String excelCode, String random){
        return String.format(ImportObject, excelCode, random, ExcelExt);
    }

    public static String buildImportFileName(String originalName){
        return String.format(ImportFileName, "导入结果", originalName);
    }

    public static String dateRandom(){
        return DateUtil.format(new Date(), "yyyyMMdd-HHmmss") +"-"+  RandomUtil.randomString(6);
    }


}
